package mhys.View.Admin;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class NavJpanel extends JPanel {
    public NavJpanel(){
        this.setBackground(new Color(240, 240, 240));
        this.setPreferredSize(new Dimension(200, 0));
        this.setLayout(null);
        this.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 2, new Color(210, 210, 210)));

        JButton teaButton = new JButton("教师列表");
        teaButton.setBackground(new Color(240, 240, 240));
        teaButton.setBorderPainted(false);
        teaButton.setFocusPainted(false);
        teaButton.setFont(new Font("微软雅黑", Font.PLAIN, 18));
        teaButton.setBounds(0, 10, 198, 35);

        JButton addButton = new JButton("教师添加");
        addButton.setBackground(new Color(240, 240, 240));
        addButton.setBorderPainted(false);
        addButton.setFocusPainted(false);
        addButton.setFont(new Font("微软雅黑", Font.PLAIN, 18));
        addButton.setBounds(0, 50, 198, 35);

        this.add(teaButton);
        this.add(addButton);

        teaButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                App.jPanel.removeAll();
               TeacherPanel teacherPanel = new TeacherPanel();
                App.jPanel.add(teacherPanel);
                App.jPanel.updateUI();
            }
        });

        addButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                App.jPanel.removeAll();
                addTeaJpanel addStuJpanel = new addTeaJpanel();
                App.jPanel.add(addStuJpanel);
                App.jPanel.updateUI();
            }
        });
    }
}
